package com.example.douyin.controller.qianduoduo;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("page")
public class PageController {

    @GetMapping("listPage")
    public String listPage(Model model){

        List<String> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(i+"");
        }
        model.addAttribute("list", list);
        model.addAttribute("title", "listPage");
        return "listPage";
    }

    @GetMapping("listPage2")
    public ModelAndView listPage2(){
        ModelAndView modelAndView = new ModelAndView("listPage");
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(i+"");
        }
        modelAndView.addObject("list", list);
        modelAndView.addObject("title", "listPage2");
        return modelAndView;
    }
}
